<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [{name:"dai",age:18},{name:"wen",age:15}];
        function deepClone(obj){
            let result;
            if(obj instanceof Array){
                result = []
            }else if(typeof obj == "object"){
                result  = {}
            }else{
                return obj
            }
            for(let key in obj){
                result[key] = deepClone(obj[key])
            }
            return result 
        }
        var newArr = deepClone(arr)
        arr[0].name = "ya"
        console.log(newArr);
    </script>
</body>
</html>